[Cocoa] NSTableView bound to NSArrayController

Posted by ndg on Stack Overflow See other posts from Stack Overflow or by ndg
Published on 2010-04-23T14:43:19Z Indexed on 2010/04/23 15:33 UTC
Read the original article Hit count: 517

Within Interface Builder I've got an NSTableView with two columns bound to a vanilla NSArrayController. The NSArrayController has its Content Array bound to an NSMutableArray in my application delegate. I've used further bindings to setup the addition and removal of rows via bindings (magic!).

The issue I'm running into now is that I'd like to grab the currently selected NSTableView row and use its index to look-up the object stored in my NSArrayControllers associated array. The problem I'm running into is trying to access the NSTableView.

Within my application delegate, using the following code will cause my application to crash:

NSLog(@"%@", [timersTableView selectedRow]);

Similarly, this also causes my application to crash:

NSLog(@"%@", [timersController selectionIndex]);

Given the simplicity of the code above, I must be doing something fundamentally wrong?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nstableview